// /common/http.api.js
// 这个是uView提供的API集中管理
// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作，更多内容详见uView对拦截器的介绍部分：
// https://uviewui.com/js/http.html#%E4%BD%95%E8%B0%93%E8%AF%B7%E6%B1%82%E6%8B%A6%E6%88%AA%EF%BC%9F
const install = (Vue, vm) => {
	// 此处使用了传入的params参数，一切自定义即可

	// 本机号码一键登录
	let phoneOneClickLogin = (params = {}) => vm.$u.post('/sys/login/phoneOneClickLogin', params);
	// 小程序获取用户的session_key和openid
	let getSessionKey = (params = {}) => vm.$u.post('/sys/login/getSessionKey',
		params);
	let getLoginUser = (params = {}) => vm.$u.post('/sys/login/getLoginUser', params); // 获取登录用户基本信息
	// 工种
	let tasktypeAll = (params = {}) => vm.$u.post('/pro/tasktype/selectAll', params);
	let taskAdd = (params = {}) => vm.$u.post('/pro/task/add', params);
	let taskFromHome = (params = {}) => vm.$u.post('/pro/task/appForHome', params); //小程序首页任务列表
	let getTaskById = (params = {}) => vm.$u.post('/pro/task/getOne', params);

	let logOut = (params = {}) => vm.$u.post('/sys/login/logOut', params); // 登出
	let engineeringUpdate = (params = {}) => vm.$u.post('/org/user/engineeringUpdate', params);




	let userUpdate = (params = {}) => vm.$u.post('/org/user/update', params);
	let getUserById = (params = {}) => vm.$u.post('/org/user/getOne', params);
	let wxPay = (params = {}) => vm.$u.post('/sys/wxpay/pay', params); // 微信付款
	let sendSms = (params = {}) => vm.$u.post('/sys/sms/send', params); // 发送验证码
	let smsJieYonghu = (params = {}) => vm.$u.post('/sys/sms/smsJieYonghu', params); // 短信通知
	let smsJieQiye = (params = {}) => vm.$u.post('/sys/sms/smsJieQiye', params); // 短信通知
	let smsQuxiao = (params = {}) => vm.$u.post('/sys/sms/smsQuxiao', params); // 短信通知

	let verificationLogin = (params = {}) => vm.$u.post('/sys/login/verification', params); // 验证码登录
	let commissionUpdate = (params = {}) => vm.$u.post('/org/user/commissionUpdate', params); // 修改我的佣金，新增
	let latAndLngToCity = (params = {}) => vm.$u.post('/org/latAndLngByGaode/latAndLngToCity', params);
	/* 任务管理 */



	let productUpdate = (params = {}) => vm.$u.post('/pro/product/update', params);

	let getProductTypeAll = (params = {}) => vm.$u.post('/pro/producttype/selectAll', params);
	let statisticsProduct = (params = {}) => vm.$u.post('/pro/product/statistics', params);
	let getOrderHall = (params = {}) => vm.$u.post('/pro/product/orderHall', params);
	let getMyFollow = (params = {}) => vm.$u.post('/pro/product/myFollow', params); // 我关注的订单列表
	let getMyFollowAll = (params = {}) => vm.$u.post('/pro/product/myFollowAll', params);
	/* 派单管理 */
	let distributeAdd = (params = {}) => vm.$u.post('/pro/distribute/add', params);
	let distributeUpdate = (params = {}) => vm.$u.post('/pro/distribute/update', params);
	let getDistributeAll = (params = {}) => vm.$u.post('/pro/distribute/selectAll', params);

	/* 收藏 */
	let collectionAdd = (params = {}) => vm.$u.post('/pro/collection/add', params);
	let collectionDelete = (params = {}) => vm.$u.post('/pro/collection/delete', params);
	let getCollectionAll = (params = {}) => vm.$u.post('/pro/collection/selectAll', params);







	vm.$u.api = {
		phoneOneClickLogin,
		getSessionKey,
		getLoginUser,
		tasktypeAll,
		taskAdd,
		taskFromHome,
		getTaskById,
		logOut,
		engineeringUpdate,

		userUpdate,
		getUserById,
		wxPay,
		sendSms,
		smsJieYonghu,
		smsJieQiye,
		smsQuxiao,
		verificationLogin,
		commissionUpdate,
		latAndLngToCity,
		/* 任务管理 */

		productUpdate,

		getProductTypeAll,
		statisticsProduct,
		getOrderHall,
		getMyFollow,
		getMyFollowAll,

		/* 派单管理 */
		distributeAdd,
		distributeUpdate,
		getDistributeAll,

		/* 收藏 */
		collectionAdd,
		collectionDelete,
		getCollectionAll,




	};
}
export default {
	install
}
